PDB: convert ptrace.c and traps.c changes to local patches
authorach61@arcadians.cl.cam.ac.uk <ach61@arcadians.cl.cam.ac.uk>
Mon, 1 Aug 2005 10:43:16 +0000 (10:43 +0000)
committerach61@arcadians.cl.cam.ac.uk <ach61@arcadians.cl.cam.ac.uk>
Mon, 1 Aug 2005 10:43:16 +0000 (10:43 +0000)
tools/debugger/pdb/Makefile
tools/debugger/pdb/linux-2.6-module/module.c
tools/debugger/pdb/linux-2.6-patches/Makefile [new file with mode: 0644]
tools/debugger/pdb/linux-2.6-patches/i386_ksyms.patch [new file with mode: 0644]
tools/debugger/pdb/linux-2.6-patches/kdebug.patch [new file with mode: 0644]
tools/debugger/pdb/linux-2.6-patches/makefile.patch [new file with mode: 0644]
tools/debugger/pdb/linux-2.6-patches/ptrace.patch [new file with mode: 0644]
tools/debugger/pdb/linux-2.6-patches/traps.patch [new file with mode: 0644]

index 12ec4be4537e37cf536398e03bf062455f6a2755..9652a110133f4f2230e2c8614cbee5f09a61cf16 100644 (file)
@@ -33,7 +33,7 @@ LIBDIRS    += ../libxendebug
 LIBS       += unix str
 
 # bc = byte-code, dc = debug byte-code
-all : dc
+all : patches dc
 
 SOURCES    += pdb_caml_xc.c 
 SOURCES    += pdb_caml_domain.c pdb_caml_process.c
@@ -50,3 +50,6 @@ RESULT      = pdb
 
 include $(OCAMLMAKEFILE)
 
+PATCHDIR    = ./linux-2.6-patches
+patches :
+       make -C $(PATCHDIR) patches
index 811c95a26d14775226874273848e42f62f65300e..c75b9cd64727f39d1b2f7438f9c06e5f34cfcffe 100644 (file)
@@ -278,14 +278,10 @@ pdb_initialize (void)
     return err;
 }
 
-extern struct notifier_block *i386die_chain;
-extern spinlock_t die_notifier_lock;
-
 static void __exit
 pdb_terminate(void)
 {
     int err = 0;
-    unsigned long flags;
 
     printk("pdb cleanup\n");
 
@@ -305,9 +301,8 @@ pdb_terminate(void)
 
     pdb_send_connection_status(PDB_CONNECTION_STATUS_DOWN, 0);
 
-       spin_lock_irqsave(&die_notifier_lock, flags);
-    err = notifier_chain_unregister(&i386die_chain, &pdb_exceptions_nb);
-       spin_unlock_irqrestore(&die_notifier_lock, flags);
+    /* handler for int1 & int3 */
+    err = unregister_die_notifier(&pdb_exceptions_nb);
 
        return;
 }
diff --git a/tools/debugger/pdb/linux-2.6-patches/Makefile b/tools/debugger/pdb/linux-2.6-patches/Makefile
new file mode 100644 (file)
index 0000000..7d06251
--- /dev/null
@@ -0,0 +1,10 @@
+XEN_ROOT   = ../../../..
+LINUX_DIR  = linux-2.6.12-xenU
+KDIR       = $(XEN_ROOT)/$(LINUX_DIR)
+PATCH_DIR  = $(CURDIR)
+
+patches : patches-done
+
+patches-done :
+       ( for i in *.patch ; do ( cd $(KDIR) ; patch -p1 < $(PATCH_DIR)/$$i || exit 1 ) ; done )
+       touch $@
diff --git a/tools/debugger/pdb/linux-2.6-patches/i386_ksyms.patch b/tools/debugger/pdb/linux-2.6-patches/i386_ksyms.patch
new file mode 100644 (file)
index 0000000..031d41b
--- /dev/null
@@ -0,0 +1,11 @@
+diff -u linux-2.6.12/arch/xen/i386/kernel/i386_ksyms.c linux-2.6.12-pdb/arch/xen/i386/kernel/i386_ksyms.c
+--- linux-2.6.12/arch/xen/i386/kernel/i386_ksyms.c     2005-07-31 22:36:50.000000000 +0100
++++ linux-2.6.12-pdb/arch/xen/i386/kernel/i386_ksyms.c 2005-08-01 10:57:31.000000000 +0100
+@@ -172,6 +172,7 @@
+ EXPORT_SYMBOL_GPL(unset_nmi_callback);
+ EXPORT_SYMBOL(register_die_notifier);
++EXPORT_SYMBOL(unregister_die_notifier);
+ #ifdef CONFIG_HAVE_DEC_LOCK
+ EXPORT_SYMBOL(_atomic_dec_and_lock);
+ #endif
diff --git a/tools/debugger/pdb/linux-2.6-patches/kdebug.patch b/tools/debugger/pdb/linux-2.6-patches/kdebug.patch
new file mode 100644 (file)
index 0000000..8ceca41
--- /dev/null
@@ -0,0 +1,11 @@
+diff -u linux-2.6.12/include/asm-i386/kdebug.h linux-2.6.12-pdb/include/asm-i386/kdebug.h
+--- linux-2.6.12/include/asm-i386/kdebug.h     2005-06-17 20:48:29.000000000 +0100
++++ linux-2.6.12-pdb/include/asm-i386/kdebug.h 2005-08-01 11:11:53.000000000 +0100
+@@ -21,6 +21,7 @@
+    If you really want to do it first unregister - then synchronize_kernel - then free.
+   */
+ int register_die_notifier(struct notifier_block *nb);
++int unregister_die_notifier(struct notifier_block *nb);
+ extern struct notifier_block *i386die_chain;
diff --git a/tools/debugger/pdb/linux-2.6-patches/makefile.patch b/tools/debugger/pdb/linux-2.6-patches/makefile.patch
new file mode 100644 (file)
index 0000000..819f853
--- /dev/null
@@ -0,0 +1,12 @@
+diff -Naur linux-2.6.12/Makefile linux-2.6.12-pdb/Makefile
+--- linux-2.6.12/Makefile      2005-08-01 01:21:21.000000000 +0100
++++ linux-2.6.12-pdb/Makefile  2005-08-01 10:28:10.000000000 +0100
+@@ -508,7 +508,7 @@
+ ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
+ CFLAGS                += -Os
+ else
+-CFLAGS                += -O2
++CFLAGS                += -O
+ endif
+ #Add align options if CONFIG_CC_* is not equal to 0
diff --git a/tools/debugger/pdb/linux-2.6-patches/ptrace.patch b/tools/debugger/pdb/linux-2.6-patches/ptrace.patch
new file mode 100644 (file)
index 0000000..98d76c4
--- /dev/null
@@ -0,0 +1,11 @@
+diff -u linux-2.6.12/kernel/ptrace.c linux-2.6.12-pdb/kernel/ptrace.c
+--- linux-2.6.12/kernel/ptrace.c       2005-06-17 20:48:29.000000000 +0100
++++ linux-2.6.12-pdb/kernel/ptrace.c   2005-07-22 13:23:16.000000000 +0100
+@@ -239,6 +239,7 @@
+        return buf - old_buf;
+ }
++EXPORT_SYMBOL(access_process_vm);
+ int ptrace_readdata(struct task_struct *tsk, unsigned long src, char __user *dst, int len)
+ {
diff --git a/tools/debugger/pdb/linux-2.6-patches/traps.patch b/tools/debugger/pdb/linux-2.6-patches/traps.patch
new file mode 100644 (file)
index 0000000..54b2ddb
--- /dev/null
@@ -0,0 +1,20 @@
+diff -u linux-2.6.12/arch/xen/i386/kernel/traps.c linux-2.6.12-pdb/arch/xen/i386/kernel/traps.c
+--- linux-2.6.12/arch/xen/i386/kernel/traps.c  2005-07-31 22:47:00.000000000 +0100
++++ linux-2.6.12-pdb/arch/xen/i386/kernel/traps.c      2005-07-31 22:47:32.000000000 +0100
+@@ -102,6 +102,16 @@
+       return err;
+ }
++int unregister_die_notifier(struct notifier_block *nb)
++{
++      int err = 0;
++      unsigned long flags;
++      spin_lock_irqsave(&die_notifier_lock, flags);
++      err = notifier_chain_unregister(&i386die_chain, nb);
++      spin_unlock_irqrestore(&die_notifier_lock, flags);
++      return err;
++}
++
+ static inline int valid_stack_ptr(struct thread_info *tinfo, void *p)
+ {
+       return  p > (void *)tinfo &&